# !/usr/bin/python
# -*- coding=utf-8 -*-
"""settings 内网测试环境"""

import os
from pathlib import Path
import environ
from book_management import base_set


class MSet(base_set.MSet):
    # 是否加密 默认启用加密

    env = environ.Env()
    BASE_DIR = Path(__file__).resolve().parent.parent
    environ.Env.read_env(environ.Env.read_env(os.path.join(BASE_DIR, '.env')))

    # 生产环境数据库用户/密码
    DB_NAME = env('MYSQL_DATABASE')
    DB_USER = env('MYSQL_USER')
    DB_PWD = env('MYSQL_PASSWORD')
    DB_PORT = env('DB_PORT')
    HOST = env('MYSQL_HOST')

    SESSION_COOKIE_AGE = 60 * 60 * 24  # SESSION 有效期1天
    SESSION_SAVE_EVERY_REQUEST = False  # 每次请求会更新sessions有效期限
    SESSION_EXPIRE_AT_BROWSER_CLOSE = False  # 关闭浏览器，则COOKIE失效
